package com.weizhu.swufer.core.exception;

public class RpcException extends RuntimeException{

    private int code;

    public final static int COMMON_ERROR = 10000;

    public final static int INVOKE_TIMEOUT = 10001;

    public final static int SERVER_REFUSE = 10002;

    public final static int TOKEN_INVALID = 10003;

    public final static int SERVER_SHUTDOWN = 10004;

    public final static int REMOTE_SERVICE_NOT_FOUND = 10404;



    public RpcException() {
        super();
    }



    public RpcException(String message, Throwable cause) {
        super(message, cause);
        code = COMMON_ERROR;
    }

    public RpcException(String message) {
        super(message);
    }

    public RpcException(Throwable cause) {
        super(cause);
    }

    public int getCode() {
        return code;
    }

    public RpcException(int code) {
        super();
        this.code = code;
    }

    public RpcException(int code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    public RpcException(int code, String message) {
        super(message);
        this.code = code;
    }

    public RpcException(int code, Throwable cause) {
        super(cause);
        this.code = code;
    }

}
